import React from 'react';
import { BackTop as AntdBackTop } from 'antd';
import type { BackTopProps as AntdBackTopProps } from 'antd';
import { createStyles } from 'antd-style';

export interface BackTopProps extends AntdBackTopProps {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  backTop: css`
    z-index: ${token.zIndexPopupBase};
  `,
}));

const BackTop: React.FC<BackTopProps> = ({ customClassName, className, ...restProps }) => {
  const { styles, cx } = useStyles();
  
  const backTopClassName = cx(
    className,
    customClassName,
    styles.backTop
  );

  return <AntdBackTop className={backTopClassName} {...restProps} />;
};

export { BackTop };
export default BackTop;

